<template>
    <a-layout>
        <a-layout-header>
            <div class="bg"><div></div></div>
            <div class="header_box">
                <div class="menu_item">
                    <div class="logo"></div>
                    <span v-for="item in menuList "
                          @click.stop="changePath(item)"
                          :class="['link' , route.name === item.name ? 'active' : '' ]">
                             {{item.meta.title}}
                        </span>
                </div>
                <div class="project_title">科右前旗药品智慧监管综合服务平台</div>
                <div class="menu_item right">
                    <div class="urlbox" v-if="urlConfig.length">
                           <span v-for="item in urlConfig">
                               {{item.name}}
                           </span>
                    </div>
                    <div class="loginOut" @click="loginOut">
                        <icon-poweroff />
                    </div>
                </div>
            </div>
        </a-layout-header>
        <a-layout-content>
            <router-view />
        </a-layout-content>
    </a-layout>
</template>

<script setup>

    import './index.less'

    const urlConfig = [
        { name: "连锁门店" },
        { name: "单体药店" },
        { name: "医疗机构" }
    ]

    const loginOut = ()=>{
        $router.push('/login')
    }

    // 当前路由
    const route = useRoute();

    const menuList = ref(route.matched[0].children)

    const changePath = (item)=>{
        $router.push({name:item.name})
    }


</script>

<style scoped></style>